Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show notification if payment requires fee acceptance #634

Conversation

danielgranhao
Copy link
Contributor

If a payment is waiting fee acceptance, let's show a notification asking the user to review the payment.

Copy link
Collaborator

@dangeross dangeross left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK

Copy link
Member

@roeierez roeierez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Note that I added a comment probably not related to this PR.

is SdkEvent.PaymentSucceeded -> handlePaymentEvent(e.details)
is SdkEvent.PaymentWaitingConfirmation -> handlePaymentSuccess(e.details)
is SdkEvent.PaymentSucceeded -> handlePaymentSuccess(e.details)
is SdkEvent.PaymentWaitingFeeAcceptance -> handlePaymentWaitingFeeAcceptance(e.details)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment here is not related to this PR but I think we might miss the notification if the app keeps working in the background and we have two sdk instances as one instance will emit it and the notifications job instance will miss it?
Perhaps we should record the state when we get the notification and poll for changes in addition to waiting for events?
@dangeross what do you think?
Even if this is indeed something we need to fix I suggest not to handle that as part of this PR as it was introduced before.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the swap is already WaitingFeeAcceptance I guess the swap isn't tracked (last swap status received in loop) when the notification SDK instance is started? If so I think you're right, we should fetch the payment by the hashed swap id, then check it's state and/or wait for events.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@roeierez I created an issue to track this. I haven't seen this in practice, but I usually stop the app when testing the notification, so I wouldn't notice it.

@danielgranhao danielgranhao force-pushed the updated-swap-fees-user-review branch from 9190972 to 86a099f Compare December 30, 2024 13:56
@danielgranhao danielgranhao force-pushed the notify-payment-waiting-fee-acceptance branch from 0c21c7e to 74c5764 Compare December 30, 2024 15:04
@danielgranhao danielgranhao marked this pull request as ready for review December 31, 2024 16:16
@danielgranhao danielgranhao force-pushed the notify-payment-waiting-fee-acceptance branch from 74c5764 to e80e907 Compare December 31, 2024 16:16
@danielgranhao
Copy link
Contributor Author

I've manually tested this on both iOS and Android, and it works as expected.

@danielgranhao danielgranhao merged commit 9632aef into updated-swap-fees-user-review Dec 31, 2024
9 checks passed
@danielgranhao danielgranhao deleted the notify-payment-waiting-fee-acceptance branch December 31, 2024 17:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants